<?php

namespace app\admin\service\statistics\datatable\lawyerhome;

use app\admin\service\statistics\datatable\AbstractQueryStatistician;
use app\admin\service\statistics\traits\CompletionTrait;
use app\admin\service\statistics\traits\FilterTrait;
use app\admin\service\statistics\traits\GrouperCreatedToDateTrait;
use app\common\model\AccessLog;
use app\common\model\Consulting;

/**
 *
 * Class LawyerHomeConsultingCount
 * @package app\admin\service\statistics\datatable\lawyerhome
 */
class LawyerConsultingCount extends AbstractQueryStatistician
{
    // 筛选器
    use FilterTrait;

    // 分组器
    use GrouperCreatedToDateTrait;

    // 补齐
    use CompletionTrait;

    protected function getQuery()
    {
        // 问题数 成功提交问题的问题数（人数去重）
        return Consulting::field(['count(DISTINCT memberId)' => 'value'])
            ->whereIn('pagePath', [AccessLog::PAGE_MEMBER_LVSHI, AccessLog::PAGE_MEMBER_LVSHIZHUYE])
            ->where('isAsked', '1');
    }

    protected function getDefaultValue()
    {
        return '0';
    }
}